package model;

public class Card implements Comparable<Card> {
	
	private Colors color;
	private int number;
	private int playerID;
	private boolean selected = false;
	
	public Card(Colors color,int number) {
		this.color = color;
		this.number = number;
		this.playerID = -2;
	}
	
	public void setSelected(boolean value) {
		selected = value;
	}
	
	public boolean isSelected() {
		return selected;
	}

	public Colors getColor() {
		return color;
	}

	public int getValue() {
		return number;
	}
	
	public boolean isBetterThan(Card comparedCard, Colors startColor, Colors trumpColor){
		if (this.color == trumpColor && comparedCard.color == trumpColor)
			return this.number > comparedCard.number;
		if (this.color == trumpColor && comparedCard.color != trumpColor)
			return true;
		if (this.color != trumpColor && comparedCard.color == trumpColor)
			return false;
		if (comparedCard.color == startColor)
			return this.number > comparedCard.number;
		
		return true;
	}

	public void setPlayer(int id) {
		playerID = id;
	}

	public int getPlayer() {
		return playerID;
	}
	
	public int compareTo(Card o) {
		if (number < o.getValue())
			return -1;
		else
			return 1;
	}

}